﻿@using BlueLotus7.Eden.Web;
@using BlueLotus7.Eden.Management.DomainScope.Models;
@model IMScopeUsersPageModel
@{
    ViewBag.Title = "View";
    Layout = Helper.MasterPageUrl;

}
@section TitleContent{
IM Domain Scope User
}
@section MainContent{
    @{
        if (Model != null)
        {
  
        <text>
        <div class="imUsers">
            <div>
                <label>Domain Scope Name:</label>
                <span class="readonly"><a target="_blank" href="@(Url.Action("ViewScope", "DomainScope", new { area = "Management", key = Model.DomainScopeKey }))">@(Helper.ConvertToDisplayString(Model.DomainScopeName))
                    </a></span>
            </div>
            <table cellpadding="0" cellspacing="0" class="bluelotus7-grid imUserGrid">
                <thead>
                    <tr>
                        <th class="identity">Identity </th>
                        <th class="status-flag"></th>
                        <th class="user-identity">User Identity </th>
                        <th class="description">Description </th>
                        <th class="need-monitor">Need Monitor</th>
                        <th class="stamp">Last Updated Stamp</th>
                        <th class="user-status">Status</th>
                    </tr>
                </thead>
                <tbody>
                    @{
            foreach (var user in Model.DomainScopeUsers)
            {
                DateTime? statusStamp = null;
                int statusValue = 0;
                string statusValueString = string.Empty;

                if (user.Status != null)
                {
                    statusStamp = user.Status.EndStamp;
                    statusValue = user.Status.Status;

                    if (Model.EnumType != null)
                    {
                        statusValueString = Enum.Parse(Model.EnumType, statusValue.ToString()).ToString();
                    }
                }
                        <text>
                        <tr>
                            <th class="identity">@(user.Key.ToString())
                            </th>
                            <td class="status-flag @(statusValueString.ToLowerInvariant())"></td>
                            <td class="user-identity"><a target="_blank" href="@(Url.Action("ViewUser", "DomainScope", new { area = "Management", key = user.Key }))">@(Helper.ConvertToDisplayString(user.ThirdPartyIdentity))
                            </a></td>
                            <td class="description">
                                @(Helper.ConvertToDisplayString(user.Description))
                            </td>
                            <td class="need-monitor" value="@(user.MonitorStatus.ToString().ToLowerInvariant())">
                                <input type="checkbox" value="true" @(user.MonitorStatus ? "checked='checked'" : string.Empty) />
                            </td>
                            <td class="stamp">@( Helper.DateTimeToString(statusStamp))
                            </td>
                            <td class="user-status @(statusValueString.ToLowerInvariant())">@(statusValueString)
                            </td>
                        </tr>
                        </text>
            }
                    }
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="7">Server Time: @(Helper.DateTimeToString(DateTime.Now))</td>
                    </tr>
                </tfoot>
            </table>
            <div class="actionPanel">
                <a class="button btn-submit">Update</a><a class="button btn-cancel">Cancel</a><a
                    class="button btn-refresh">Refresh</a>
            </div>
        </div>
        </text>
        }  
    }
}
@section ResourceReferences{
    <script type="text/javascript">
    $(document).ready(function () {
        initBtnForIMUsers($("div.imUsers"));
    });

    </script>
}
@section SideNavigator{
}
